import java.util.Scanner;

public class demo04 {
    public static void main(String[] args) {
        //饮料换购
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int sum=n;
        int tmp=n;
        while (tmp>=3){
            sum+=tmp/3;
            tmp=tmp/3+tmp%3;
        }
        System.out.println(sum);
    }
}
